package com.wakaca.design.pattern.behavioral.observer;

import java.util.Observable;
import java.util.Observer;

/**
 * 教师类
 * 对于讲师来说检查的是课程，不是问题，问题属于课程
 * Created by wakac on 2019/4/3
 */
public class Teacher implements Observer{
    private String teacherName;

    public Teacher(String teacherName) {
        this.teacherName = teacherName;
    }

    public String getTeacherName() {
        return teacherName;
    }

    public void update(Observable o, Object arg) {
        Course course = (Course)o;
        Question question = (Question) arg;
        System.out.println(teacherName+" 老师的 "+course.getCourseName()+" " +
                "课程接受到一个 "+question.getUserName()+" 提交的 "+question.getQuestionContent());
    }
}
